home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / HCAL-27 / TANKCCT.BAS (.txt) < prev    next >
Encoding:
GW-BASIC  |  1997-01-29  |  6.4 KB  |  223 lines

  1. 10  'TANKCCT - Power Amplifier - 11 AUG 95 rev. 29 SEP 96
  2. 20  IF EX$=""THEN EX$="EXIT"
  3. 30  CLS:KEY OFF
  4. 40  COLOR 7,0,1
  5. 50  U$="#####.###"
  6. 60  UL$=STRING$(80,205)
  7. 70  E$=STRING$(80,32)
  8. 80  PI=3.14159
  9. 90  DIM CF(11,2)     'centre frequencies of HF bands
  10. 100  DATA 0, 160, 80, 40, 30, 20, 17, 15, 12, 10, 1
  11. 110  DATA 1.8, 1.9, 3.75, 7.15, 10.125, 14.175
  12. 120  DATA 18.118, 21.225, 24.94, 28.85, 29.7
  13. 130  FOR Z=1 TO 11:READ CF(Z,1):NEXT Z
  14. 140  FOR Z=1 TO 11:READ CF(Z,2):NEXT Z
  15. 150  '
  16. 160  '.....start
  17. 170  CLS:CTUN=0:R1=0:R2=0:Q=0:F=0
  18. 180  COLOR 15,2
  19. 190  PRINT " TANK CIRCUIT - Power Amplifier (Vacuum Tube Type)";
  20. 200  PRINT TAB(57);"by George Murphy VE3ERP ";
  21. 210  COLOR 1,0:PRINT STRING$(80,223);
  22. 220  COLOR 7,0
  23. 230  GOSUB 1540:PRINT UL$;      'diagram
  24. 240  LN=CSRLIN
  25. 250  GOSUB 1710                 'preface
  26. 260  COLOR 0,7:LOCATE 25,22
  27. 270  PRINT " Press 1 to continue or 0 to EXIT.....";
  28. 280  COLOR 7,0
  29. 290  Z$=INKEY$:IF Z$=""THEN 290
  30. 300  IF Z$="0"THEN CLS:RUN EX$
  31. 310  IF Z$="1"THEN 330
  32. 320  GOTO 290
  33. 330  GOSUB 2100                 'dump screen
  34. 340  VIEW PRINT LN TO 24:CLS:VIEW PRINT:LOCATE LN
  35. 350  GOTO 420
  36. 360  '
  37. 370  '.....format input line
  38. 380  LOCATE CSRLIN-1:PRINT SPC(7);
  39. 390  LOCATE CSRLIN,47:PRINT STRING$(7,".");USING U$;Z;
  40. 400  RETURN
  41. 410  '
  42. 420  '.....data input
  43. 430  PRINT TAB(T);
  44. 440  PRINT "C1 should not be less than 35 pF for vacuum variable capacitors."
  45. 450  PRINT TAB(T);
  46. 460  PRINT "C1 should not be less than 45-50 pF for air variable capacitors."
  47. 470  INPUT " ENTER: Minimum capacitance of C1................(pF)";CTUN
  48. 480  IF CTUN=0 THEN LOCATE CSRLIN-1:PRINT E$;:LOCATE CSRLIN-1:GOTO 470
  49. 490  VIEW PRINT 9 TO 24:CLS:VIEW PRINT:LOCATE 9
  50. 500  PRINT "        Minimum capacitance of C1....................";USING U$;CTUN;
  51. 510  PRINT " pF"
  52. 520  INPUT " ENTER: INPUT resistance R1....................(ohms)";R1
  53. 530  IF R1=0 THEN LOCATE CSRLIN-1:PRINT E$;:LOCATE CSRLIN-1:GOTO 520
  54. 540  Z=R1:GOSUB 370:PRINT " -"
  55. 550  INPUT " ENTER: LOAD  resistance R2....................(ohms)";R2
  56. 560  IF R2=0 THEN LOCATE CSRLIN-1:PRINT E$;:LOCATE CSRLIN-1:GOTO 550
  57. 570  Z=R2:GOSUB 370:PRINT " -"
  58. 580  '
  59. 590  MIN1=R1/R2-1:MIN2=R2\R1-1
  60. 600  IF MIN1>MIN2 THEN MIN=MIN1 ELSE MIN=R2
  61. 610  QMIN=SQR(MIN)+0.000999999
  62. 620  '
  63. 630  PRINT "        Minimum circuit operating Q..................";USING U$;QMIN
  64. 640  INPUT " ENTER: Desired circuit operating Q..................";Q
  65. 650  IF Q<QMIN THEN LOCATE CSRLIN-1:PRINT E$;:LOCATE CSRLIN-1:GOTO 640
  66. 660  QO=Q
  67. 670  Z=QO:GOSUB 370:PRINT ""
  68. 680  '
  69. 690  INPUT " ENTER: Operating Frequency.....................(MHz)";F
  70. 700  IF F=0 THEN LOCATE CSRLIN-1:PRINT E$;:LOCATE CSRLIN-1:GOTO 690
  71. 710  Z=F:GOSUB 370:PRINT " MHz"
  72. 720  '
  73. 730  '.....calculate values
  74. 740  Q1=(R1*QO-SQR(R1*R2*QO^2-(R1-R2)^2))/(R1-R2)
  75. 750  Q2=QO-Q1
  76. 760  XC1=R1/Q1
  77. 770  XC2=R2/Q2
  78. 780  XL=R1*QO/(Q1^2+1)
  79. 790  C1=1/(2*PI*F*XC1)*10^6
  80. 800  C2=1/(2*PI*F*XC2)*10^6
  81. 810  L=XL/(2*PI*F)
  82. 820  IF C1<CTUN-9.9999E-05 THEN 1010
  83. 830  PRINT "        Input Q......................................";USING U$;Q1
  84. 840  PRINT "        Output Q.....................................";USING U$;Q2
  85. 850  PRINT "        Reactance - Capacitor C1.....................";USING U$;XC1
  86. 860  Z=XC1:GOSUB 370:PRINT " -"
  87. 870  PRINT "        Reactance - Capacitor C2.....................";USING U$;XC2
  88. 880  Z=XC2:GOSUB 370:PRINT " -"
  89. 890  PRINT "        Reactance - Inductor L1......................";USING U$;XL
  90. 900  Z=XL:GOSUB 370:PRINT " -"
  91. 910  PRINT "        Capacitor C1.................................";USING U$;C1;
  92. 920  PRINT " pF"
  93. 930  PRINT "        Capacitor C2.................................";USING U$;C2;
  94. 940  PRINT " pF"
  95. 950  PRINT "        Inductor L1..................................";USING U$;L;
  96. 960  PRINT " >H"
  97. 970  PRINT "        Actual circuit operating Q...................";USING U$;QO
  98. 980  GOSUB 2100
  99. 990  GOTO 1070
  100. 1000  '
  101. 1010  '.....recalculate QO if c1<minimum pF
  102. 1020  XC1=1/(2*PI*F*CTUN)*10^6
  103. 1030  Q1=R1/XC1
  104. 1040  QO=Q1+Q2
  105. 1050  GOTO 730
  106. 1060  '
  107. 1070  '.....table of values
  108. 1080  COLOR 0,7
  109. 1090  LOCATE 3,1:PRINT R1;"-"
  110. 1100  LOCATE 4,1:PRINT " in DEFDBL"
  111. 1110  LOCATE 3,40:PRINT R2;"-"
  112. 1120  COLOR 7,0
  113. 1130  VIEW PRINT LN TO 24:CLS:VIEW PRINT:LOCATE LN
  114. 1140  PRINT TAB(16);"TYPICAL CONTROL SETTINGS for the HF AMATEUR BANDS"
  115. 1150  PRINT "  Band";
  116. 1160  PRINT TAB(13);"MHz";TAB(24);"C1 (pF)";TAB(42);"C2 (pF)";
  117. 1170  PRINT TAB(61);"L1 (>H)";TAB(74);"Q"
  118. 1180  PRINT UL$;
  119. 1190  QO=Q
  120. 1200  '
  121. 1210  '.....start loop
  122. 1220  FOR Z=1 TO 11
  123. 1230  '
  124. 1240  Q1=(R1*QO-SQR(R1*R2*QO^2-(R1-R2)^2))/(R1-R2)
  125. 1250  Q2=QO-Q1
  126. 1260  XC1=R1/Q1
  127. 1270  XC2=R2/Q2
  128. 1280  XL=R1*QO/(Q1^2+1)
  129. 1290  FQ=CF(Z,2)
  130. 1300  K1=(1/(2*PI*FQ*XC1))*10^6
  131. 1310  K2=(1/(2*PI*FQ*XC2))*10^6
  132. 1320  IF K1<CTUN-9.9999E-05 THEN 1480
  133. 1330  LL=(XL/(2*PI*FQ))
  134. 1340  IF CF(Z,1)=0 THEN PRINT " (max.)";:GOTO 1370
  135. 1350  IF CF(Z,1)=1 THEN PRINT " (min.)";:GOTO 1370
  136. 1360  PRINT USING "#####";CF(Z,1);
  137. 1370  PRINT TAB(8);USING U$;CF(Z,2);
  138. 1380  PRINT TAB(24);USING "#####";K1;
  139. 1390  PRINT TAB(42);USING "#####";K2;
  140. 1400  PRINT TAB(59);USING "#####.##";LL;
  141. 1410  PRINT TAB(73);USING "##.#";QO;
  142. 1420  IF Z=1 OR Z=10 THEN PRINT "  "+STRING$(74,196):GOTO 1440
  143. 1430  IF Z<11 THEN PRINT ""
  144. 1440  NEXT Z
  145. 1450  '.....end of loop
  146. 1460  GOTO 2050
  147. 1470  '
  148. 1480  '.....recalculate if K1<minimum pF
  149. 1490  XC1=1/(2*PI*FQ*CTUN)*10^6
  150. 1500  Q1=R1/XC1
  151. 1510  QO=Q1+Q2
  152. 1520  GOTO 1240
  153. 1530  '
  154. 1540  '.....diagram
  155. 1550  LN=CSRLIN:T=3:T1=50
  156. 1560  LOCATE LN+0,T1:PRINT "Cb:    blocking capacitor"
  157. 1570  LOCATE LN+1,T1:PRINT "C1,C2: variable capacitors"
  158. 1580  LOCATE LN+2,T1:PRINT "L1:    variable inductor or"
  159. 1590  LOCATE LN+3,T1:PRINT "         tapped coil"
  160. 1600  LOCATE LN+4,T1:PRINT "rfc:   RF choke"
  161. 1610  LOCATE LN
  162. 1620  COLOR 0,7
  163. 1630  PRINT TAB(T);" R1         Cb      L1                R2    "
  164. 1640  PRINT TAB(T);"   VARPTRSOUNDSOUNDSOUNDSOUNDSOUNDBSAVESOUNDSOUNDUSINGSOUNDSOUNDBSAVESOUNDSOUNDSOUNDORORORORSOUNDSOUNDSOUNDBSAVESOUNDSOUNDSOUNDSOUNDSOUNDBSAVESOUNDSOUNDDEFDBL output "
  165. 1650  PRINT TAB(T);" SOUNDSOUNDMOTORSOUNDSOUND  rfc   THENINSTRTHENC1    C2THENINSTRTHEN   rfc          "
  166. 1660  PRINT TAB(T);" plate   CALL     CALLtune  loadCALL     CALL           "
  167. 1670  PRINT TAB(T);"        +HV  \\MOTOR\\      \\MOTOR\\ \\MOTOR\\ chassis "
  168. 1680  COLOR 7,0
  169. 1690  RETURN
  170. 1700  '
  171. 1710  '.....preface
  172. 1720  T=7
  173. 1730  PRINT TAB(T);
  174. 1740  PRINT"  You will be asked to enter the input resistance (plate impedance)"
  175. 1750  PRINT TAB(T);
  176. 1760  PRINT"which for most tetrode amplifier tubes is in the order of from"
  177. 1770  PRINT TAB(T);
  178. 1780  PRINT"1500 to 2500 ohms. You will also be asked to enter the output (load)"
  179. 1790  PRINT TAB(T);
  180. 1800  PRINT"resistance (typically the input impedance of the antenna system)."
  181. 1810  PRINT TAB(T);
  182. 1820  PRINT"  You must also enter the desired Q of the tank circuit. A low Q is"
  183. 1830  PRINT TAB(T);
  184. 1840  PRINT"desirable for best efficiency, but yields poor harmonic suppression."
  185. 1850  PRINT TAB(T);
  186. 1860  PRINT"High Q keeps the harmonic levels low but tank efficiency suffers."
  187. 1870  PRINT TAB(T);
  188. 1880  PRINT"A value of Q=12 is a reasonable and popular compromise. Generally,"
  189. 1890  PRINT TAB(T);
  190. 1900  PRINT"values of up to about Q=25 are acceptable."
  191. 1910  PRINT TAB(T);
  192. 1920  PRINT"  To provide enough capacitance for tuning, C1 should not be less"
  193. 1930  PRINT TAB(T);
  194. 1940  PRINT"than 35-50 pF. If the program calculates a lesser value the Q of the"
  195. 1950  PRINT TAB(T);
  196. 1960  PRINT"circuit will be recalculated to increase C1 to a pre-determined"
  197. 1970  PRINT TAB(T);
  198. 1980  PRINT"minimum value."
  199. 1990  PRINT TAB(T);
  200. 2000  PRINT "   (This program is based on design data and formulae presented in"
  201. 2010  PRINT TAB(T);
  202. 2020  PRINT"the 1994 ARRL HANDBOOK for RADIO AMATEURS, starting on page 15-3).
  203. 2030  RETURN
  204. 2040  '
  205. 2050  '.....end
  206. 2060  GOSUB 2100
  207. 2070  GOTO 160   'start
  208. 2080  END
  209. 2090  '
  210. 2100  'HARDCOPY
  211. 2110  GOSUB 2220:LOCATE 25,2:COLOR 14,6
  212. 2120  PRINT " Press 1 to print screen, 2 to print screen & ";
  213. 2130  PRINT "advance paper, or 3 to continue.";:COLOR 7,0
  214. 2140  Z$=INKEY$:IF Z$="3"THEN GOSUB 2220:RETURN
  215. 2150  IF Z$="1"OR Z$="2"THEN GOSUB 2220:GOTO 2170
  216. 2160  GOTO 2140
  217. 2170  FOR QX=1 TO 24:FOR QY=1 TO 80
  218. 2180  LPRINT CHR$(SCREEN(QX,QY));
  219. 2190  NEXT QY:NEXT QX
  220. 2200  IF Z$="2"THEN LPRINT CHR$(12)
  221. 2210  GOTO 2110
  222. 2220  LOCATE 25,1:PRINT STRING$(80,32);:RETURN
  223.